<template>
  <div>
      <h2>我是用户界面</h2>
        <h3>通过/user/:userid传递参数</h3>
      <!-- 通过计算属性得到传过来的userid -->
      <h2>我是{{userid}}</h2>
      <!-- 直接获取userid，相比于计算属性，不需要加this -->
      <h2>我是{{$route.params.userid}}</h2>
  </div>
</template>

<script>
export default {
    name:'User',
    computed: {
        userid(){
            return this.$route.params.userid
        }
    },
    created() {
        console.log('user-created');
        
    },
    destroyed() {
        console.log('user-destroyed');
    }
}
</script>

<style>

</style>